<?php
require_once( dirname(__FILE__).'/bencode.php' );

$bc = new AC_Bencode();

$str = file_get_contents( './t1.torrent' );

$res = $bc->decode( $str, false, false );
if ( is_array($res) ) {
    if ( isset( $res['info'] ) && isset( $res['info']['pieces'] ) ) {
        $res['info']['pieces'] = '<binary data>';
    }
    echo '<pre>';
    print_r( $res );
    echo '</pre>';
}
else {
    echo 'Bad torrent file';
}

?>
